﻿using System;

namespace _1365_how_many_numbers_are_smaller_than_the_current_number
{
    class Program
    {
        static void Main (string[] args)
        {
            int[] nums = new int[] { 8, 8, 8, 8 };
            nums = SmallerNumbersThanCurrent (nums);
            for (int i = 0;i < nums.Length;i++)
            {
                Console.Write (nums[i] + " ");
            }
        }
        public static int[] SmallerNumbersThanCurrent (int[] nums)
        {
            int[] minNums = new int[nums.Length];
            for (int i = 0;i < nums.Length;i++)
            {
                minNums[i] = MinNumber (nums, nums[i]);
            }
            return minNums;
        }

        static int MinNumber (int[] nums, int num)
        {
            int count = 0;
            for (int i = 0;i < nums.Length;i++)
            {
                if (num > nums[i]) count++;
            }
            return count;
        }
    }
}
